package nil.ed.simulator.request.client.activity;

import com.google.inject.Inject;
import nil.ed.simulator.request.enums.ActivityGroup;

import java.util.Map;

/**
 * @author lidelin.
 */
public class ActivityEngine {

    @Inject
    private ActivityRepo activityRepo;

    public void process(ActivityGroup group, Map<String, Object> context) {
        for (IActivity activity : activityRepo.getActivities(group)) {
            if (!activity.process(context)) {
                context.put(BuiltInAttrs.INTERRUPT_ACTIVITY_ATTR, activity);
                break;
            }
        }
    }

}
